import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import '../style/less/main.css';
import axios from '../api/index';
import {Button ,mountNode } from 'antd';
import { addTodo } from "../../actions";
class Headers extends React.Component{
    constructor(){
        super();
        
        
    }
    componentWillMount(){
        axios.api.mockData3().then((res)=>{
            let mock = res.array;
            this.setState({
                data:mock
            })
        });
      
    }
    render(){
        let input;
        return(
            <div>
                <from onSubmit={e=>{
                    e.preventDefault();
                    if(!input.value.trim()){
                        return
                    }
                    dispatch(addTodo(input.value))
                    input.value=''
                }}>
                <input ref={node=>{input=node}}/>
                <button>添加</button>
                </from>
            </div>
           )
    }
}

export default Headers;